package cn.lesion.JavaBean;

import javax.persistence.*;

/**
 * Created in Intellij IDEA .
 * Author : e.le.lee .
 * Date : 2015-12-31-0031 .
 */
@Entity
@Table(name = "admin", schema = "mycms" )
public class AdminEntity {
    private int adminId;
    private String adminName;
    private String adminPassword;
    private String adminPhone;

    @Id
    @Column(name = "admin_id", nullable = false)
    public int getAdminId() {
        return adminId;
    }

    public void setAdminId(int adminId) {
        this.adminId = adminId;
    }

    @Basic
    @Column(name = "admin_name", nullable = false, length = 255)
    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    @Basic
    @Column(name = "admin_password", nullable = false, length = 255)
    public String getAdminPassword() {
        return adminPassword;
    }

    public void setAdminPassword(String adminPassword) {
        this.adminPassword = adminPassword;
    }

    @Basic
    @Column(name = "admin_phone", nullable = false, length = 255)
    public String getAdminPhone() {
        return adminPhone;
    }

    public void setAdminPhone(String adminPhone) {
        this.adminPhone = adminPhone;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AdminEntity that = (AdminEntity) o;

        if (adminId != that.adminId) return false;
        if (adminName != null ? !adminName.equals(that.adminName) : that.adminName != null) return false;
        if (adminPassword != null ? !adminPassword.equals(that.adminPassword) : that.adminPassword != null)
            return false;
        if (adminPhone != null ? !adminPhone.equals(that.adminPhone) : that.adminPhone != null) return false;

        return true;
    }

    public AdminEntity(String adminName, String adminPassword, String adminPhone) {
        this.adminName = adminName;
        this.adminPassword = adminPassword;
        this.adminPhone = adminPhone;
    }

    public AdminEntity(int adminId, String adminName, String adminPassword, String adminPhone) {
        this.adminId = adminId;
        this.adminName = adminName;
        this.adminPassword = adminPassword;
        this.adminPhone = adminPhone;
    }

    public AdminEntity() {
    }

    @Override
    public int hashCode() {
        int result = adminId;
        result = 31 * result + (adminName != null ? adminName.hashCode() : 0);
        result = 31 * result + (adminPassword != null ? adminPassword.hashCode() : 0);
        result = 31 * result + (adminPhone != null ? adminPhone.hashCode() : 0);
        return result;
    }
}
